﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CRM.BLL;
using CRM.Entity;

namespace CRM.Web.AvayaICSoftPhone
{
    public partial class TranCall : Common.PageBase
    {
        private string agent = "Agent.gif";
        private string agentout = "AgentOut.gif";
        public string Temp = "<div style='width: 150px; float: left; text-align: left; overflow:hidden;'><table border='0' width='100%' ><tr><td width='43'><a style='cursor:pointer; cursor:hand;  ' ><img src='../images/SoftPhone/pic.jpg' width='43' height='41' alt='{2}' class='imgTel' ></a></td><td ><div align='center' style='cursor:pointer; cursor:hand;  '  alt='{2}' class='imgTel' ><b>{0}</b>({2})</div></td></tr></table></div>";
        public string UserInfo = "";

        private UserLoginInfo _userLoginInfo;
        private T_CONFIG_BLL configBll = new T_CONFIG_BLL();

        private T_USER_BLL userBll = new T_USER_BLL();

        protected override void OnInit(EventArgs e)
        {
            base.VerificationRight = false;
            base.OnInit(e);
            _userLoginInfo = UserLoginInfo.GetLoginInfo();
            txtOutCode.Text = configBll.GetCacheValueByName(this.Page, "OutCode");

        }
        protected void Page_Load(object sender, EventArgs e)
        {
            List<T_USER_Entity> list =
                userBll.GetList(String.Format(" and DEPARTMENTID = '{0}' ",
                                              _userLoginInfo.UserEntity.DEPARTMENTID.ToString()));

            foreach (T_USER_Entity en in list)
            {
                if (string.IsNullOrEmpty(en.SEATID.Trim()))
                {
                    continue;
                }
                UserInfo += String.Format(Temp, en.USERNAME, agent, en.SEATID.Trim());
            }
        }
    }
}
